﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Controls="clr-namespace:Fluent">
    <Style x:Key="{x:Type Controls:StatusBar}"
           TargetType="{x:Type Controls:StatusBar}">
        <Setter Property="SnapsToDevicePixels"
                Value="True" />
        <Setter Property="Height"
                Value="24" />
        <Setter Property="Margin"
                Value="0,0,0,-1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:StatusBar}">
                    <Border Height="Auto"
                            BorderThickness="0,1"
                            Background="{DynamicResource RibbonThemeColorBrush}">
                        <ItemsPresenter x:Name="itemsPresenter" Height="Auto" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsWindowMaximized"
                                 Value="False">
                            <Setter Property="Margin"
                                    TargetName="itemsPresenter"
                                    Value="0,0,16,0" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Controls:StatusBarPanel IsItemsHost="True"
                                             Height="Auto"
                                             Margin="0"
                                             VerticalAlignment="Stretch" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="RibbonStatusBarItemStyle"
           TargetType="{x:Type Controls:StatusBarItem}">
        <Setter Property="VerticalAlignment"
                Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:StatusBarItem}">
                    <ContentPresenter Margin="{TemplateBinding Padding}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsEnabled"
                     Value="False">
                <Setter Property="Foreground"
                        Value="#FF888888" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--Menu Item Style-->
    <Style TargetType="{x:Type Controls:StatusBarMenuItem}">
        <Setter Property="Template"
                Value="{DynamicResource RibbonStatusBarContextMenuItemControlTemplate}" />
        <Setter Property="Foreground"
                Value="{DynamicResource DefaultFontBrush}" />
        <Setter Property="IsCheckable"
                Value="True" />
        <Setter Property="IsChecked"
                Value="{Binding StatusBarItem.IsChecked, RelativeSource={RelativeSource Self}, Mode=TwoWay}" />
    </Style>

    <!--Menu Item Template-->
    <ControlTemplate x:Key="RibbonStatusBarContextMenuItemControlTemplate"
                     TargetType="{x:Type Controls:StatusBarMenuItem}">
        <Grid Width="Auto"
              Height="24"
              Background="#00000000">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="25" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Border x:Name="border"
                    HorizontalAlignment="Stretch"
                    Margin="0"
                    Width="Auto"
                    Visibility="Collapsed"
                    Background="{DynamicResource ButtonHoverOuterBackgroundBrush}"
                    BorderBrush="{DynamicResource ButtonHoverOuterBorderBrush}"
                    BorderThickness="1"
                    Grid.Column="0"
                    Grid.ColumnSpan="3">
                <Border Background="{DynamicResource ButtonHoverInnerBackgroundBrush}"
                        BorderBrush="{DynamicResource ButtonHoverInnerBorderBrush}"
                        BorderThickness="1" />
            </Border>
            <TextBlock x:Name="textBlock_Copy"
                       Text="{Binding StatusBarItem.Title, RelativeSource={RelativeSource TemplatedParent}}"
                       Width="Auto"
                       Height="Auto"
                       Margin="9,3,30,3"
                       VerticalAlignment="Center"
                       Grid.Column="1"
                       TextTrimming="None"
                       Visibility="Hidden"
                       HorizontalAlignment="Left" />
            <TextBlock x:Name="textBlock"
                       Text="{Binding StatusBarItem.Title, RelativeSource={RelativeSource TemplatedParent}}"
                       Width="Auto"
                       Height="Auto"
                       Margin="5,3,3,3"
                       VerticalAlignment="Center"
                       Grid.Column="1"
                       TextTrimming="CharacterEllipsis" />
            <Image x:Name="image"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center"
                   Source="{DynamicResource MenuCheckedImage}"
                   Stretch="None"
                   Visibility="Collapsed"
                   SnapsToDevicePixels="True" />
            <Image x:Name="iconImage"
                   HorizontalAlignment="Center"
                   Margin="3,2,2,2"
                   VerticalAlignment="Center"
                   Width="Auto"
                   Source="{TemplateBinding Icon}"
                   SnapsToDevicePixels="True" />
            <TextBlock Text="{Binding StatusBarItem.Value, RelativeSource={RelativeSource TemplatedParent}}"
                       Width="Auto"
                       Height="Auto"
                       Margin="9,3,3,3"
                       VerticalAlignment="Center"
                       Grid.Column="3"
                       TextTrimming="CharacterEllipsis" />
            <Path x:Name="path"
                  Stretch="Fill"
                  Stroke="{x:Null}"
                  HorizontalAlignment="Right"
                  Margin="1,0,4,0"
                  Width="4"
                  Data="M0,0L1,1 0,2z"
                  Height="6"
                  Grid.Column="3">
                <Path.Fill>
                    <LinearGradientBrush EndPoint="0.945,0.872"
                                         StartPoint="0.055,0.128">
                        <GradientStop Color="Black"
                                      Offset="1" />
                        <GradientStop Color="#FF828282" />
                    </LinearGradientBrush>
                </Path.Fill>
            </Path>
        </Grid>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Icon"
                               Value="{x:Null}" />
                    <Condition Property="IsChecked"
                               Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Visibility"
                        TargetName="image"
                        Value="Visible" />
            </MultiTrigger>
            <Trigger Property="HasItems"
                     Value="False">
                <Setter Property="Visibility"
                        TargetName="path"
                        Value="Collapsed" />
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsHighlighted"
                               Value="True" />
                    <Condition Property="IsEnabled"
                               Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Visibility"
                        TargetName="border"
                        Value="Visible" />
            </MultiTrigger>
            <!--<Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5"/>
        <Setter Property="Opacity" TargetName="image" Value="0.5"/>
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5"/>
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect/>
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect/>
          </Setter.Value>
        </Setter>
      </Trigger>-->
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style BasedOn="{StaticResource RibbonStatusBarItemStyle}"
           TargetType="{x:Type Controls:StatusBarItem}" />
</ResourceDictionary>